package eraserhead.xml.request;

import xml.Message;
import client.ServerAccess;

/**
 * Class for sending a SignIn request.
 * @author Michael Checca
 */
public class SignInRequest {
	/**
	 * Sends a SignInRequest to the server.
	 * @param sa {@link ServerAccess} to send the {@link Message} to
	 * @param id Event id
	 * @param name Username to send
	 * @param password Optional password to send
	 */
	public static void send(ServerAccess sa, String id, String name, String password) {
		String xmlMessage = String.format(
				"%s<signInRequest id=\"%s\"><user name=\"%s\" password=\"%s\"/></signInRequest></request>",
				Message.requestHeader(), id, name, password);
		sa.sendRequest(new Message(xmlMessage));
	}
}
